package com.example.exception;

public class SelfException extends RuntimeException{
    //异常编码
    private int code;
    //异常信息
    private String msg;

    //构造器，传入自定义枚举异常类
    public SelfException(SelfExceptionEnum selfExceptionEnum){
        super();
        this.code = selfExceptionEnum.getCode();
        this.msg = selfExceptionEnum.getMsg();
    }

    //构造器，传入指定的值
    public SelfException(int code , String msg){
        super();
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
